<?php

    define("HTTP_SERVER", "http://localhost/GPA/");
    define("IMAGE_URL", HTTP_SERVER . "images/");
    define("CSS_URL", HTTP_SERVER . "css/");
    define("JS_URL", HTTP_SERVER . "js/");
    define("MYSQL_USER", "root");
    define("MYSQL_PASS", "");
    define("MYSQL_DB", "gpa_new");
    define("TABLE_PREFIX", "gpa_");

    if(count($_POST)) {
        $referrer = parse_url(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : HTTP_SERVER);
        $host = parse_url(HTTP_SERVER);
        $reg = '|^'.preg_quote($host['scheme']).'://[a-zA-Z0-9\.]*'.preg_quote($host['host']).'/|i';

        if(!preg_match($reg, $referrer['scheme'].'://'.$referrer['host'].'/')) {
            die("sorry, but you're trying to post from another host. nice try!");
        }
    }

    ini_set("register_globals", "Off");
    ini_set("magic_quotes_gpc", "Off");
    ini_set("short_open_tag", "Off");

    session_start();
    $MYSQL = mysql_connect("localhost", MYSQL_USER, MYSQL_PASS);
    mysql_select_db(MYSQL_DB, $MYSQL);

?>